package bintree.leetcode;

import java.util.HashSet;
import java.util.Set;

public class leetcode961再长度为2N的数组中找到重复n次的元素 {
    public int repeatedNTimes(int[] nums) {
        Set<Integer> set = new HashSet<>();
        for (int i :nums) {
            if (!set.add(i)){
                return nums[i];
            }
        }
        return -1;
    }
}
